#ifndef _BANGAIO_FORMAT_H_
#define _BANGAIO_FORMAT_H_

#include <sys/types.h>

#define FORMAT_LEVEL 0
#define FORMAT_REPLAY 1
#define FORMAT_INCOMPLETE -1
#define FORMAT_INVALID -2

#define SIZE_INCOMPLETE -1
#define SIZE_INVALID -2

#define FILE_OK 0
#define FILE_FORMAT_INVALID 1
#define FILE_SIZE_INVALID 2
#define FILE_INCOMPLETE 3
#define FILE_EMPTY 4
#define FILE_CHECKSUM_INVALID 5

int file_format(u_int8_t *bytes,int length);
int file_size(u_int8_t *bytes,int length);
int is_file_complete(u_int8_t *bytes,int length);
int is_checksum_correct(u_int8_t *bytes,int length);
void fix_checksum(u_int8_t *bytes,int length);
int analyze_file(u_int8_t *bytes,int length);
char *level_name(u_int8_t *bytes,int length);

#endif
